﻿<%@ page language="C#" autoeventwireup="true" CodeBehind="EmailTemplate.aspx.cs" inherits="StreetSmartAdmin.EmailTemplate" %>
<%@ Register TagPrefix="CustUserCtrl" TagName="Header" Src="Header.ascx" %>
<%@ Register TagPrefix="CustUserCtrl" TagName="Footer" Src="Footer.ascx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Street Smart Energy Admin</title>
    <link type="text/css" rel="stylesheet" href="style.css" />
</head>
<body>
  <div> 
   <form id="form1" runat="server">    
       <CustUserCtrl:Header id="Header" runat="server"></CustUserCtrl:Header>
       <br />
        <asp:GridView ID="gvPerson" runat="server" AutoGenerateColumns="False"
         EnableModelValidation="True" PageSize="50" DataSourceID="SqlDataSource1"
            CssClass="mGrid" DataKeyNames="EmailTemplateID"
            PagerStyle-CssClass="pgr"
            AlternatingRowStyle-CssClass="alt">
             <Columns>
                <asp:CommandField ShowEditButton="True" />
                <asp:CommandField ShowDeleteButton="True" />
                <asp:CommandField ShowDeleteButton="True"  Visible="false"/>
                <asp:TemplateField HeaderText="ID"  SortExpression="EmailTemplateID">            
                    <ItemTemplate>
                        <asp:Label ID="EmailTemplateID" runat="server" Text='<%# Bind("EmailTemplateID") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Name"  SortExpression="EmailTemplateName">
                    <EditItemTemplate>
                        <asp:TextBox ID="EmailTemplateName" runat="server" Text='<%# Bind("EmailTemplateName") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="EmailTemplateNameLabel" runat="server" Text='<%# Bind("EmailTemplateName") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Subject" SortExpression="EmailTemplateSubject">
                    <EditItemTemplate>
                        <asp:TextBox ID="EmailTemplateSubject"  runat="server" TextMode="MultiLine" Text='<%# Bind("EmailTemplateSubject") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="EmailTemplateSubjectLabel" runat="server" Text='<%# Bind("EmailTemplateSubject") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Body" SortExpression="EmailTemplateBody">
                    <EditItemTemplate>
                        <asp:TextBox ID="EmailTemplateBody" rows="30" width="97%" runat="server" TextMode="MultiLine" Text='<%# Bind("EmailTemplateBody") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="EmailTemplateBodyLabel" runat="server" Text='<%# Bind("EmailTemplateBody") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>       
   
     <br />
        <asp:Button ID="lbtnAdd" text= "Add New" runat="server" onclick="lbtnAdd_Click" />
         </form>

     </div>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:SQLServer2005DBConnectionString %>"   
        SelectCommand="SELECT * FROM glob1001.[tblEmailTemplate]"
        DeleteCommand="DELETE FROM glob1001.[tblEmailTemplate] where EmailTemplateID=@EmailTemplateID"
        UpdateCommand="UPDATE glob1001.[tblEmailTemplate] SET EmailTemplateName = @EmailTemplateName, EmailTemplateSubject = @EmailTemplateSubject, EmailTemplateBody = @EmailTemplateBody where EmailTemplateID = @EmailTemplateID">
    </asp:SqlDataSource>
</body>   
</html>
